package com.xzx.shop_front_api.service.impl;
import com.xzx.shop_front_api.entity.*;
import com.xzx.shop_front_api.mapper.MembersMapper;
import com.xzx.shop_front_api.service.MembersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MembersServiceImpl implements MembersService {

    @Autowired
    private MembersMapper membersMapper;
    @Override
    public int insertMembers(Members members) {
        return membersMapper.insertMembers(members);
    }

    @Override
    public Members getMembersByUsername(String username) {
        return membersMapper.getMembersByUsername(username);
    }

    @Override
    public int updatePassword(String username, String password) {
        return membersMapper.updatePassword(username, password);
    }

    @Override
    public int updatePayPassword(int id, String payPassword) {
        return membersMapper.updatePayPassword(id, payPassword);
    }

    @Override
    public Members getMembersById(int id) {
        return membersMapper.getMembersById(id);
    }

    @Override
    public Members getMembersByMobile(String mobile) {
        return membersMapper.getMembersByMobile(mobile);
    }

    @Override
    public int updateMobile(int id, String mobile) {
        return membersMapper.updateMobile(id, mobile);
    }

    @Override
    public int updateMyInfo(int id, String username, String nickname, int gender, String birthday) {
        return membersMapper.updateMyInfo(id, username, nickname, gender, birthday);
    }

    @Override
    public int updateLogo(int id, String logo) {
        return membersMapper.updateLogo(id, logo);
    }

    @Override
    public int updateIsAuth(int id, int isAuth) {
        return membersMapper.updateIsAuth(id, isAuth);
    }

    @Override
    public Members getMemberWithIdCard(int id) {
        return membersMapper.getMemberWithIdCard(id);
    }

    @Override
    public List<District> getDistrictBypId(int pId) {
        return membersMapper.getDistrictBypId(pId);
    }

    @Override
    public int insertAddress(Address address) {
        return membersMapper.insertAddress(address);
    }

    @Override
    public int updateDefaultedAddress(int memberId, int isDefaulted) {
        return membersMapper.updateDefaultedAddress(memberId, isDefaulted);
    }

    @Override
    public Members getMembersAddressListByMemberId(int memberId) {
        return membersMapper.getMembersAddressListByMemberId(memberId);
    }

    @Override
    public District getDistrictById(int id) {
        return membersMapper.getDistrictById(id);
    }

    @Override
    public int deleteAddressById(int id) {
        return membersMapper.deleteAddressById(id);
    }

    @Override
    public Address getAddressById(int id) {
        return membersMapper.getAddressById(id);
    }
}
